package edu.sctu.practice.class02.hujie.cgs.assign05.four;

/**
 * Created by hp on 2015/12/17.
 */
public class Sort_Demo1 {
    int i, j, k, swap;

    Sort_Demo1() {
        i = j = k = swap = 0;
    }

    void sort(int t1, int t2[]) {//父类的方法中实现升序
//用选择法实现升序排列
        for (i = 0; i < t1 - 1; i++) {
            k = i;
            for (j = i + 1; j < t1; j++)
                if (t2[j] < t2[k])
                    k = j;
            if (k != i) {
                swap = t2[i];
                t2[i] = t2[k];
                t2[k] = swap;
            }
        }
    }
}
